<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>5-0</title>
</head>
<body>
<h1>商品添加页面</h1>
<div>
  <input type="text" v-model="product.title" placeholder="商品标题">
  <input type="text" v-model="product.price" placeholder="商品价格">
  <input type="text" v-model="product.saleCount" placeholder="商品销量">
  <input type="button" value="添加" @click="insert()">
</div>
<script src="js/vue.js"></script>
<script src="js/axios.min.js"></script>
<script>
  let v = new Vue({
    el:"div",
    data:{
      product:{
        title:"",price:"",saleCount:""
      }
    },
    methods:{
      insert() {
        axios.post("/insert", v.product).then(function () {
          alert("商品添加成功");
          location.href="list.html";
        });
      }
    }
  });
</script>
</body>
</html>